<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            width: 100px;
            background-color: lightsalmon;
        }

        div:nth-child(1) {
            margin: 10px 20px 30px 40px;
            padding: 10px 20px 30px 40px;
        }

        div:nth-child(2) {
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div>文本1</div>
    <div>文本2</div>
</body>

</html>